#!/bin/bash
Get the current user
CURRENT_USER=$(whoami)

Check if the user is logged in via SSH
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
 echo "$CURRENT_USER is logged in via SSH" 
fi

Check if the user is logged in via a local terminal
if [ -n "$WINDOW" ]; then 
echo "$CURRENT_USER is logged in via a local terminal"
 fi
